import React from 'react'
import style from"./login.module.css"
import { Button, Checkbox, Form } from 'antd';
import { useNavigate } from 'react-router-dom';
import logo from '../../assets/images/login/logo.png';

export default function Login() {
    const navigate = useNavigate();

    const handleSubmit = (event) => {
        event.preventDefault();
        const values = {
            username: event.target.username.value,
            password: event.target.password.value,
        };
        console.log('Success:', values);
        navigate('/dashboard'); // 如果需要导航，添加导航逻辑
    };

    const handleChangePassword = () => {
        console.log('修改密码');
    };

    return (
        <div className={style.login}>
            <img src={logo} alt="Logo" className={style.pageLogo} />
            <div className={style.content}>
                
                <h2 className={style.title}>账号密码登录</h2>
                <form onSubmit={handleSubmit}>
                    <div className={style.inputGroup}>
                        <span className={style.icon}>👤</span>
                        <input
                            type="text"
                            name="username"
                            placeholder="请输入登录账号"
                            required
                            className={style.input}
                        />
                    </div>
                    <div className={style.inputGroup}>
                        <span className={style.icon}>🔒</span>
                        <input
                            type="password"
                            name="password"
                            placeholder="请输入登录密码"
                            required
                            className={style.input}
                        />
                    </div>
                    <div className={style.options}>
                        <label>
                            <input type="checkbox" name="remember" />
                            记住密码
                        </label>
                        <button type="button" onClick={handleChangePassword} className={style.linkButton}>
                            修改密码
                        </button>
                    </div>
                    <button type="submit" className={style.loginButton}>
                        登录
                    </button>
                </form>
            </div>
        </div>
    )
}
